package com.xxxx.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LoggingAspect {

    // 定义切入点：所有Service层方法
    @Pointcut("execution(* com.xxxx.aop.Component1.publish(..))")
    private void publish() {}

    @After("publish()")
    public void logAfter(JoinPoint joinPoint) {
        System.out.println("发送短信: " + joinPoint.getSignature().getName());
    }
}
